load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_library(
    name = "mononoke_api",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "dependencies_override": {"dependencies": {"sapling-sparse": {"features": ["async"]}}},
        "extra_buck_dependencies": {"dependencies": ["//eden/scm/lib/sparse:sparse"]},
    }},
    named_deps = ({} if rust_oss.is_oss_build() else {
        "MononokeApiStats_ods3_types": "//eden/mononoke/facebook/ods3_schemas:MononokeApiStats_ods3-rust",
    }),
    test_deps = [
        "fbsource//third-party/rust:assert_matches",
        "fbsource//third-party/rust:gix-object",
        "fbsource//third-party/rust:pretty_assertions",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph_testlib:commit_graph_testlib",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/fixtures:fixtures",
        "//eden/mononoke/tests/utils:tests_utils",
        "//eden/scm/lib/types:types",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:chrono",
        "fbsource//third-party/rust:derivative",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:futures-util",
        "fbsource//third-party/rust:gix-hash",
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:lazy_static",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:regex",
        "fbsource//third-party/rust:smallvec",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tracing",
        "fbsource//third-party/rust:vec1",
        "//common/rust/shed/borrowed:borrowed",
        "//common/rust/shed/bounded_traversal:bounded_traversal",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/futures_ext:futures_ext",
        "//common/rust/shed/futures_lazy_shared:futures_lazy_shared",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/shed/sorted_vector_map:sorted_vector_map",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/acl_regions:acl_regions",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/blobstore:ephemeral_blobstore",
        "//eden/mononoke/bonsai_git_mapping:bonsai_git_mapping",
        "//eden/mononoke/bonsai_globalrev_mapping:bonsai_globalrev_mapping",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/bonsai_svnrev_mapping:bonsai_svnrev_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/bookmarks:bookmarks_cache",
        "//eden/mononoke/bookmarks:bookmarks_movement",
        "//eden/mononoke/changesets/changesets_creation:changesets_creation",
        "//eden/mononoke/commit_cloud:commit_cloud",
        "//eden/mononoke/commit_cloud/types:commit_cloud_types",
        "//eden/mononoke/commit_rewriting/live_commit_sync_config:live_commit_sync_config",
        "//eden/mononoke/commit_rewriting/synced_commit_mapping:synced_commit_mapping",
        "//eden/mononoke/common/futures_watchdog:futures_watchdog",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/derived_data:basename_suffix_skeleton_manifest_v3",
        "//eden/mononoke/derived_data:blame",
        "//eden/mononoke/derived_data:bulk_derivation",
        "//eden/mononoke/derived_data:changeset_info",
        "//eden/mononoke/derived_data:deleted_manifest",
        "//eden/mononoke/derived_data:derived_data",
        "//eden/mononoke/derived_data:derived_data_manager",
        "//eden/mononoke/derived_data:fsnodes",
        "//eden/mononoke/derived_data:skeleton_manifest",
        "//eden/mononoke/derived_data:skeleton_manifest_v2",
        "//eden/mononoke/derived_data:unodes",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/features/history_traversal:history_traversal",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "//eden/mononoke/filenodes:filenodes",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/git/bundle_uri:bundle_uri",
        "//eden/mononoke/git/git_types:git_types",
        "//eden/mononoke/git/packfile:packfile",
        "//eden/mononoke/git/protocol:protocol",
        "//eden/mononoke/git_ref_content_mapping:git_ref_content_mapping",
        "//eden/mononoke/git_source_of_truth:git_source_of_truth",
        "//eden/mononoke/git_symbolic_refs:git_symbolic_refs",
        "//eden/mononoke/hooks:hooks",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/megarepo_api:megarepo_error",
        "//eden/mononoke/mercurial:mercurial_mutation",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_repos:mononoke_repos",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/mutable_counters:mutable_counters",
        "//eden/mononoke/mutable_renames:mutable_renames",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/pushrebase:pushrebase",
        "//eden/mononoke/pushrebase:pushrebase_client",
        "//eden/mononoke/pushrebase_mutation_mapping:pushrebase_mutation_mapping",
        "//eden/mononoke/repo_attributes/bonsai_tag_mapping:bonsai_tag_mapping",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/commit_graph/sql_commit_graph_storage:sql_commit_graph_storage",
        "//eden/mononoke/repo_attributes/hook_manager/hook_manager:hook_manager",
        "//eden/mononoke/repo_attributes/mutable_blobstore:mutable_blobstore",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_bookmark_attrs:repo_bookmark_attrs",
        "//eden/mononoke/repo_attributes/repo_cross_repo:repo_cross_repo",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_event_publisher:repo_event_publisher",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_attributes/repo_lock:repo_lock",
        "//eden/mononoke/repo_attributes/repo_permission_checker:repo_permission_checker",
        "//eden/mononoke/repo_attributes/repo_sparse_profiles:repo_sparse_profiles",
        "//eden/mononoke/repo_attributes/restricted_paths:restricted_paths",
        "//eden/mononoke/repo_attributes/sql_query_config:sql_query_config",
        "//eden/mononoke/repo_authorization:repo_authorization",
        "//eden/mononoke/repo_client:streaming_clone",
        "//eden/mononoke/repo_client:unbundle",
        "//eden/mononoke/repo_stats_logger:repo_stats_logger",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/wireproto_handler:wireproto_handler",
        "//eden/scm/lib/dag/dag-types:dag-types",
        "//eden/scm/lib/edenapi/types:edenapi_types",
        "//eden/scm/lib/pathmatcher:pathmatcher",
        "//eden/scm/lib/sparse:sparse-async",
        "//eden/scm/lib/types:types",
        "//eden/scm/lib/xdiff:xdiff",
    ] + ([] if rust_oss.is_oss_build() else [
        "fbsource//third-party/rust:lazy_static",
        "//eden/mononoke/facebook/ods3_schemas:MononokeApiStats_ods3-rs_bindings",
    ]),
)
